import React, { Component } from "react";
import { HashRouter as Router, Route, Switch, Redirect } from "react-router-dom";
import $ from 'jquery'

import Nav from './pageComponents/nav';
import Footer, { StaticFooter } from './pageComponents/footer';

import Home from "./pages/home";
import About from './pages/about'
import Map from './pages/map'

import './index.css'

export default class App extends Component {
    componentDidMount() {
        this.router.history.listen(route => {
            //当路由发生变化

        })
    }

    render() {
        return <Router ref={ref => this.router = ref} forcerefresh={true}>
            <div ref={ref => global.AppContainer = ref} className="AppContainer">
                <Nav />
                <Switch>
                    <Route exact path="/" component={Home} />
                    <Route path="/about" component={About} />
                    <Route path="/map" component={Map} />

                    <Redirect from="/*" to="/" />
                </Switch>
                <div class="push"></div>
            </div>
            <Footer />
        </Router>
    }
}
